//app.js
App({
  onLaunch: function () {
    var that=this;
   
    wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    })

    wx.getSystemInfo({

      success: (res) => {
     
        that.globalData.systm = JSON.stringify(res);
        that.globalData.nav_top = res.statusBarHeight
        that.globalData.nav_height = 44 + res.statusBarHeight
        that.globalData.win_height=res.windowHeight
        that.globalData.win_width=res.windowWidth
      }
    });
//登录信息
    var val = wx.getStorageSync('login_info');
    
    if (val) {
      var d = JSON.parse(val);
      console.log(d);
      that.globalData.user_id = d.id;
      that.globalData.session = d.session;
      that.globalData.user_info = d;
console.log('缓存登录成功');

    }

var user_session=wx.getStorageSync('user_session');
if(!user_session){
  user_session=Math.ceil(((new Date).getTime()/1000));
  
  try {
    wx.setStorageSync('user_session',user_session)
  } catch (e) { }
}
console.log(user_session);
that.globalData.user_session = user_session;
  },
  onShow: function (options) {
    //这里也可以获取
     this.globalData.shareTicket = options.shareTicket;
     console.log(options.shareTicket);
 },

  globalData: {
    server:'https://www.zjhn.com/shop/jl.php',user_id:0,
    logo:'https://zjhn-1253789145.cos.ap-guangzhou.myqcloud.com/jl/logo.jpg',
    app_name:'海宁优选',
    shareTicket:''
  },err: function (t) {
    wx.showModal({
      title: '提示',
      content: t,
    })
  },msg:function(t){wx.showToast({ title: t });},
})